use crate::environment::models::ToCloudProviderFormat;
use serde_derive::{Deserialize, Serialize};
use std::fmt::{Display, Formatter};
use std::str::FromStr;
use strum_macros::EnumIter;

#[derive(Serialize, Deserialize, PartialEq, Eq, Debug, Clone, EnumIter)]
// Sync with Qovery Core team if you update this content
// Formatted Zones can be retrieved with this command:
// gcloud compute zones list --format json | jq -r 'map(.name |= (ascii_downcase | gsub("-(?<a>[a-z])"; .a|ascii_upcase))) | .[].name | ./"" | first |= ascii_upcase | add' | sort
pub enum GcpZone {
    AsiaEast1A,
    AsiaEast1B,
    AsiaEast1C,
    AsiaEast2A,
    AsiaEast2B,
    AsiaEast2C,
    AsiaNortheast1A,
    AsiaNortheast1B,
    AsiaNortheast1C,
    AsiaNortheast2A,
    AsiaNortheast2B,
    AsiaNortheast2C,
    AsiaNortheast3A,
    AsiaNortheast3B,
    AsiaNortheast3C,
    AsiaSouth1A,
    AsiaSouth1B,
    AsiaSouth1C,
    AsiaSouth2A,
    AsiaSouth2B,
    AsiaSouth2C,
    AsiaSoutheast1A,
    AsiaSoutheast1B,
    AsiaSoutheast1C,
    AsiaSoutheast2A,
    AsiaSoutheast2B,
    AsiaSoutheast2C,
    AustraliaSoutheast1A,
    AustraliaSoutheast1B,
    AustraliaSoutheast1C,
    AustraliaSoutheast2A,
    AustraliaSoutheast2B,
    AustraliaSoutheast2C,
    EuropeCentral2A,
    EuropeCentral2B,
    EuropeCentral2C,
    EuropeNorth1A,
    EuropeNorth1B,
    EuropeNorth1C,
    EuropeSouthwest1A,
    EuropeSouthwest1B,
    EuropeSouthwest1C,
    EuropeWest10A,
    EuropeWest10B,
    EuropeWest10C,
    EuropeWest12A,
    EuropeWest12B,
    EuropeWest12C,
    EuropeWest1B,
    EuropeWest1C,
    EuropeWest1D,
    EuropeWest2A,
    EuropeWest2B,
    EuropeWest2C,
    EuropeWest3A,
    EuropeWest3B,
    EuropeWest3C,
    EuropeWest4A,
    EuropeWest4B,
    EuropeWest4C,
    EuropeWest6A,
    EuropeWest6B,
    EuropeWest6C,
    EuropeWest8A,
    EuropeWest8B,
    EuropeWest8C,
    EuropeWest9A,
    EuropeWest9B,
    EuropeWest9C,
    MeCentral1A,
    MeCentral1B,
    MeCentral1C,
    MeCentral2A,
    MeCentral2B,
    MeCentral2C,
    MeWest1A,
    MeWest1B,
    MeWest1C,
    NorthAmericaNortheast1A,
    NorthAmericaNortheast1B,
    NorthAmericaNortheast1C,
    NorthAmericaNortheast2A,
    NorthAmericaNortheast2B,
    NorthAmericaNortheast2C,
    SouthAmericaEast1A,
    SouthAmericaEast1B,
    SouthAmericaEast1C,
    SouthAmericaWest1A,
    SouthAmericaWest1B,
    SouthAmericaWest1C,
    UsCentral1A,
    UsCentral1B,
    UsCentral1C,
    UsCentral1F,
    UsEast1B,
    UsEast1C,
    UsEast1D,
    UsEast4A,
    UsEast4B,
    UsEast4C,
    UsEast5A,
    UsEast5B,
    UsEast5C,
    UsSouth1A,
    UsSouth1B,
    UsSouth1C,
    UsWest1A,
    UsWest1B,
    UsWest1C,
    UsWest2A,
    UsWest2B,
    UsWest2C,
    UsWest3A,
    UsWest3B,
    UsWest3C,
    UsWest4A,
    UsWest4B,
    UsWest4C,
}

impl GcpZone {
    /// Region for the Zone
    pub fn region(&self) -> GcpRegion {
        match &self {
            GcpZone::AsiaEast1A => GcpRegion::AsiaEast1,
            GcpZone::AsiaEast1B => GcpRegion::AsiaEast1,
            GcpZone::AsiaEast1C => GcpRegion::AsiaEast1,
            GcpZone::AsiaEast2A => GcpRegion::AsiaEast2,
            GcpZone::AsiaEast2B => GcpRegion::AsiaEast2,
            GcpZone::AsiaEast2C => GcpRegion::AsiaEast2,
            GcpZone::AsiaNortheast1A => GcpRegion::AsiaNortheast1,
            GcpZone::AsiaNortheast1B => GcpRegion::AsiaNortheast1,
            GcpZone::AsiaNortheast1C => GcpRegion::AsiaNortheast1,
            GcpZone::AsiaNortheast2A => GcpRegion::AsiaNortheast2,
            GcpZone::AsiaNortheast2B => GcpRegion::AsiaNortheast2,
            GcpZone::AsiaNortheast2C => GcpRegion::AsiaNortheast2,
            GcpZone::AsiaNortheast3A => GcpRegion::AsiaNortheast3,
            GcpZone::AsiaNortheast3B => GcpRegion::AsiaNortheast3,
            GcpZone::AsiaNortheast3C => GcpRegion::AsiaNortheast3,
            GcpZone::AsiaSouth1A => GcpRegion::AsiaSouth1,
            GcpZone::AsiaSouth1B => GcpRegion::AsiaSouth1,
            GcpZone::AsiaSouth1C => GcpRegion::AsiaSouth1,
            GcpZone::AsiaSouth2A => GcpRegion::AsiaSouth2,
            GcpZone::AsiaSouth2B => GcpRegion::AsiaSouth2,
            GcpZone::AsiaSouth2C => GcpRegion::AsiaSouth2,
            GcpZone::AsiaSoutheast1A => GcpRegion::AsiaSoutheast1,
            GcpZone::AsiaSoutheast1B => GcpRegion::AsiaSoutheast1,
            GcpZone::AsiaSoutheast1C => GcpRegion::AsiaSoutheast1,
            GcpZone::AsiaSoutheast2A => GcpRegion::AsiaSoutheast2,
            GcpZone::AsiaSoutheast2B => GcpRegion::AsiaSoutheast2,
            GcpZone::AsiaSoutheast2C => GcpRegion::AsiaSoutheast2,
            GcpZone::AustraliaSoutheast1A => GcpRegion::AustraliaSoutheast1,
            GcpZone::AustraliaSoutheast1B => GcpRegion::AustraliaSoutheast1,
            GcpZone::AustraliaSoutheast1C => GcpRegion::AustraliaSoutheast1,
            GcpZone::AustraliaSoutheast2A => GcpRegion::AustraliaSoutheast2,
            GcpZone::AustraliaSoutheast2B => GcpRegion::AustraliaSoutheast2,
            GcpZone::AustraliaSoutheast2C => GcpRegion::AustraliaSoutheast2,
            GcpZone::EuropeCentral2A => GcpRegion::EuropeCentral2,
            GcpZone::EuropeCentral2B => GcpRegion::EuropeCentral2,
            GcpZone::EuropeCentral2C => GcpRegion::EuropeCentral2,
            GcpZone::EuropeNorth1A => GcpRegion::EuropeNorth1,
            GcpZone::EuropeNorth1B => GcpRegion::EuropeNorth1,
            GcpZone::EuropeNorth1C => GcpRegion::EuropeNorth1,
            GcpZone::EuropeSouthwest1A => GcpRegion::EuropeSouthwest1,
            GcpZone::EuropeSouthwest1B => GcpRegion::EuropeSouthwest1,
            GcpZone::EuropeSouthwest1C => GcpRegion::EuropeSouthwest1,
            GcpZone::EuropeWest10A => GcpRegion::EuropeWest10,
            GcpZone::EuropeWest10B => GcpRegion::EuropeWest10,
            GcpZone::EuropeWest10C => GcpRegion::EuropeWest10,
            GcpZone::EuropeWest12A => GcpRegion::EuropeWest12,
            GcpZone::EuropeWest12B => GcpRegion::EuropeWest12,
            GcpZone::EuropeWest12C => GcpRegion::EuropeWest12,
            GcpZone::EuropeWest1B => GcpRegion::EuropeWest1,
            GcpZone::EuropeWest1C => GcpRegion::EuropeWest1,
            GcpZone::EuropeWest1D => GcpRegion::EuropeWest1,
            GcpZone::EuropeWest2A => GcpRegion::EuropeWest2,
            GcpZone::EuropeWest2B => GcpRegion::EuropeWest2,
            GcpZone::EuropeWest2C => GcpRegion::EuropeWest2,
            GcpZone::EuropeWest3A => GcpRegion::EuropeWest3,
            GcpZone::EuropeWest3B => GcpRegion::EuropeWest3,
            GcpZone::EuropeWest3C => GcpRegion::EuropeWest3,
            GcpZone::EuropeWest4A => GcpRegion::EuropeWest4,
            GcpZone::EuropeWest4B => GcpRegion::EuropeWest4,
            GcpZone::EuropeWest4C => GcpRegion::EuropeWest4,
            GcpZone::EuropeWest6A => GcpRegion::EuropeWest6,
            GcpZone::EuropeWest6B => GcpRegion::EuropeWest6,
            GcpZone::EuropeWest6C => GcpRegion::EuropeWest6,
            GcpZone::EuropeWest8A => GcpRegion::EuropeWest8,
            GcpZone::EuropeWest8B => GcpRegion::EuropeWest8,
            GcpZone::EuropeWest8C => GcpRegion::EuropeWest8,
            GcpZone::EuropeWest9A => GcpRegion::EuropeWest9,
            GcpZone::EuropeWest9B => GcpRegion::EuropeWest9,
            GcpZone::EuropeWest9C => GcpRegion::EuropeWest9,
            GcpZone::MeCentral1A => GcpRegion::MeCentral1,
            GcpZone::MeCentral1B => GcpRegion::MeCentral1,
            GcpZone::MeCentral1C => GcpRegion::MeCentral1,
            GcpZone::MeCentral2A => GcpRegion::MeCentral2,
            GcpZone::MeCentral2B => GcpRegion::MeCentral2,
            GcpZone::MeCentral2C => GcpRegion::MeCentral2,
            GcpZone::MeWest1A => GcpRegion::MeWest1,
            GcpZone::MeWest1B => GcpRegion::MeWest1,
            GcpZone::MeWest1C => GcpRegion::MeWest1,
            GcpZone::NorthAmericaNortheast1A => GcpRegion::NorthAmericaNortheast1,
            GcpZone::NorthAmericaNortheast1B => GcpRegion::NorthAmericaNortheast1,
            GcpZone::NorthAmericaNortheast1C => GcpRegion::NorthAmericaNortheast1,
            GcpZone::NorthAmericaNortheast2A => GcpRegion::NorthAmericaNortheast2,
            GcpZone::NorthAmericaNortheast2B => GcpRegion::NorthAmericaNortheast2,
            GcpZone::NorthAmericaNortheast2C => GcpRegion::NorthAmericaNortheast2,
            GcpZone::SouthAmericaEast1A => GcpRegion::SouthAmericaEast1,
            GcpZone::SouthAmericaEast1B => GcpRegion::SouthAmericaEast1,
            GcpZone::SouthAmericaEast1C => GcpRegion::SouthAmericaEast1,
            GcpZone::SouthAmericaWest1A => GcpRegion::SouthAmericaWest1,
            GcpZone::SouthAmericaWest1B => GcpRegion::SouthAmericaWest1,
            GcpZone::SouthAmericaWest1C => GcpRegion::SouthAmericaWest1,
            GcpZone::UsCentral1A => GcpRegion::UsCentral1,
            GcpZone::UsCentral1B => GcpRegion::UsCentral1,
            GcpZone::UsCentral1C => GcpRegion::UsCentral1,
            GcpZone::UsCentral1F => GcpRegion::UsCentral1,
            GcpZone::UsEast1B => GcpRegion::UsEast1,
            GcpZone::UsEast1C => GcpRegion::UsEast1,
            GcpZone::UsEast1D => GcpRegion::UsEast1,
            GcpZone::UsEast4A => GcpRegion::UsEast4,
            GcpZone::UsEast4B => GcpRegion::UsEast4,
            GcpZone::UsEast4C => GcpRegion::UsEast4,
            GcpZone::UsEast5A => GcpRegion::UsEast5,
            GcpZone::UsEast5B => GcpRegion::UsEast5,
            GcpZone::UsEast5C => GcpRegion::UsEast5,
            GcpZone::UsSouth1A => GcpRegion::UsSouth1,
            GcpZone::UsSouth1B => GcpRegion::UsSouth1,
            GcpZone::UsSouth1C => GcpRegion::UsSouth1,
            GcpZone::UsWest1A => GcpRegion::UsWest1,
            GcpZone::UsWest1B => GcpRegion::UsWest1,
            GcpZone::UsWest1C => GcpRegion::UsWest1,
            GcpZone::UsWest2A => GcpRegion::UsWest2,
            GcpZone::UsWest2B => GcpRegion::UsWest2,
            GcpZone::UsWest2C => GcpRegion::UsWest2,
            GcpZone::UsWest3A => GcpRegion::UsWest3,
            GcpZone::UsWest3B => GcpRegion::UsWest3,
            GcpZone::UsWest3C => GcpRegion::UsWest3,
            GcpZone::UsWest4A => GcpRegion::UsWest4,
            GcpZone::UsWest4B => GcpRegion::UsWest4,
            GcpZone::UsWest4C => GcpRegion::UsWest4,
        }
    }
}

impl ToCloudProviderFormat for GcpZone {
    fn to_cloud_provider_format(&self) -> &str {
        match self {
            GcpZone::AsiaEast1A => "asia-east1-a",
            GcpZone::AsiaEast1B => "asia-east1-b",
            GcpZone::AsiaEast1C => "asia-east1-c",
            GcpZone::AsiaEast2A => "asia-east2-a",
            GcpZone::AsiaEast2B => "asia-east2-b",
            GcpZone::AsiaEast2C => "asia-east2-c",
            GcpZone::AsiaNortheast1A => "asia-northeast1-a",
            GcpZone::AsiaNortheast1B => "asia-northeast1-b",
            GcpZone::AsiaNortheast1C => "asia-northeast1-c",
            GcpZone::AsiaNortheast2A => "asia-northeast2-a",
            GcpZone::AsiaNortheast2B => "asia-northeast2-b",
            GcpZone::AsiaNortheast2C => "asia-northeast2-c",
            GcpZone::AsiaNortheast3A => "asia-northeast3-a",
            GcpZone::AsiaNortheast3B => "asia-northeast3-b",
            GcpZone::AsiaNortheast3C => "asia-northeast3-c",
            GcpZone::AsiaSouth1A => "asia-south1-a",
            GcpZone::AsiaSouth1B => "asia-south1-b",
            GcpZone::AsiaSouth1C => "asia-south1-c",
            GcpZone::AsiaSouth2A => "asia-south2-a",
            GcpZone::AsiaSouth2B => "asia-south2-b",
            GcpZone::AsiaSouth2C => "asia-south2-c",
            GcpZone::AsiaSoutheast1A => "asia-southeast1-a",
            GcpZone::AsiaSoutheast1B => "asia-southeast1-b",
            GcpZone::AsiaSoutheast1C => "asia-southeast1-c",
            GcpZone::AsiaSoutheast2A => "asia-southeast2-a",
            GcpZone::AsiaSoutheast2B => "asia-southeast2-b",
            GcpZone::AsiaSoutheast2C => "asia-southeast2-c",
            GcpZone::AustraliaSoutheast1A => "australia-southeast1-a",
            GcpZone::AustraliaSoutheast1B => "australia-southeast1-b",
            GcpZone::AustraliaSoutheast1C => "australia-southeast1-c",
            GcpZone::AustraliaSoutheast2A => "australia-southeast2-a",
            GcpZone::AustraliaSoutheast2B => "australia-southeast2-b",
            GcpZone::AustraliaSoutheast2C => "australia-southeast2-c",
            GcpZone::EuropeCentral2A => "europe-central2-a",
            GcpZone::EuropeCentral2B => "europe-central2-b",
            GcpZone::EuropeCentral2C => "europe-central2-c",
            GcpZone::EuropeNorth1A => "europe-north1-a",
            GcpZone::EuropeNorth1B => "europe-north1-b",
            GcpZone::EuropeNorth1C => "europe-north1-c",
            GcpZone::EuropeSouthwest1A => "europe-southwest1-a",
            GcpZone::EuropeSouthwest1B => "europe-southwest1-b",
            GcpZone::EuropeSouthwest1C => "europe-southwest1-c",
            GcpZone::EuropeWest10A => "europe-west10-a",
            GcpZone::EuropeWest10B => "europe-west10-b",
            GcpZone::EuropeWest10C => "europe-west10-c",
            GcpZone::EuropeWest12A => "europe-west12-a",
            GcpZone::EuropeWest12B => "europe-west12-b",
            GcpZone::EuropeWest12C => "europe-west12-c",
            GcpZone::EuropeWest1B => "europe-west1-b",
            GcpZone::EuropeWest1C => "europe-west1-c",
            GcpZone::EuropeWest1D => "europe-west1-d",
            GcpZone::EuropeWest2A => "europe-west2-a",
            GcpZone::EuropeWest2B => "europe-west2-b",
            GcpZone::EuropeWest2C => "europe-west2-c",
            GcpZone::EuropeWest3A => "europe-west3-a",
            GcpZone::EuropeWest3B => "europe-west3-b",
            GcpZone::EuropeWest3C => "europe-west3-c",
            GcpZone::EuropeWest4A => "europe-west4-a",
            GcpZone::EuropeWest4B => "europe-west4-b",
            GcpZone::EuropeWest4C => "europe-west4-c",
            GcpZone::EuropeWest6A => "europe-west6-a",
            GcpZone::EuropeWest6B => "europe-west6-b",
            GcpZone::EuropeWest6C => "europe-west6-c",
            GcpZone::EuropeWest8A => "europe-west8-a",
            GcpZone::EuropeWest8B => "europe-west8-b",
            GcpZone::EuropeWest8C => "europe-west8-c",
            GcpZone::EuropeWest9A => "europe-west9-a",
            GcpZone::EuropeWest9B => "europe-west9-b",
            GcpZone::EuropeWest9C => "europe-west9-c",
            GcpZone::MeCentral1A => "me-central1-a",
            GcpZone::MeCentral1B => "me-central1-b",
            GcpZone::MeCentral1C => "me-central1-c",
            GcpZone::MeCentral2A => "me-central2-a",
            GcpZone::MeCentral2B => "me-central2-b",
            GcpZone::MeCentral2C => "me-central2-c",
            GcpZone::MeWest1A => "me-west1-a",
            GcpZone::MeWest1B => "me-west1-b",
            GcpZone::MeWest1C => "me-west1-c",
            GcpZone::NorthAmericaNortheast1A => "northamerica-northeast1-a",
            GcpZone::NorthAmericaNortheast1B => "northamerica-northeast1-b",
            GcpZone::NorthAmericaNortheast1C => "northamerica-northeast1-c",
            GcpZone::NorthAmericaNortheast2A => "northamerica-northeast2-a",
            GcpZone::NorthAmericaNortheast2B => "northamerica-northeast2-b",
            GcpZone::NorthAmericaNortheast2C => "northamerica-northeast2-c",
            GcpZone::SouthAmericaEast1A => "southamerica-east1-a",
            GcpZone::SouthAmericaEast1B => "southamerica-east1-b",
            GcpZone::SouthAmericaEast1C => "southamerica-east1-c",
            GcpZone::SouthAmericaWest1A => "southamerica-west1-a",
            GcpZone::SouthAmericaWest1B => "southamerica-west1-b",
            GcpZone::SouthAmericaWest1C => "southamerica-west1-c",
            GcpZone::UsCentral1A => "us-central1-a",
            GcpZone::UsCentral1B => "us-central1-b",
            GcpZone::UsCentral1C => "us-central1-c",
            GcpZone::UsCentral1F => "us-central1-f",
            GcpZone::UsEast1B => "us-east1-b",
            GcpZone::UsEast1C => "us-east1-c",
            GcpZone::UsEast1D => "us-east1-d",
            GcpZone::UsEast4A => "us-east4-a",
            GcpZone::UsEast4B => "us-east4-b",
            GcpZone::UsEast4C => "us-east4-c",
            GcpZone::UsEast5A => "us-east5-a",
            GcpZone::UsEast5B => "us-east5-b",
            GcpZone::UsEast5C => "us-east5-c",
            GcpZone::UsSouth1A => "us-south1-a",
            GcpZone::UsSouth1B => "us-south1-b",
            GcpZone::UsSouth1C => "us-south1-c",
            GcpZone::UsWest1A => "us-west1-a",
            GcpZone::UsWest1B => "us-west1-b",
            GcpZone::UsWest1C => "us-west1-c",
            GcpZone::UsWest2A => "us-west2-a",
            GcpZone::UsWest2B => "us-west2-b",
            GcpZone::UsWest2C => "us-west2-c",
            GcpZone::UsWest3A => "us-west3-a",
            GcpZone::UsWest3B => "us-west3-b",
            GcpZone::UsWest3C => "us-west3-c",
            GcpZone::UsWest4A => "us-west4-a",
            GcpZone::UsWest4B => "us-west4-b",
            GcpZone::UsWest4C => "us-west4-c",
        }
    }
}

impl Display for GcpZone {
    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.to_cloud_provider_format())
    }
}

impl FromStr for GcpZone {
    type Err = ();

    fn from_str(s: &str) -> Result<GcpZone, ()> {
        let v: &str = &s.to_lowercase();
        match v {
            "asia-east1-a" => Ok(GcpZone::AsiaEast1A),
            "asia-east1-b" => Ok(GcpZone::AsiaEast1B),
            "asia-east1-c" => Ok(GcpZone::AsiaEast1C),
            "asia-east2-a" => Ok(GcpZone::AsiaEast2A),
            "asia-east2-b" => Ok(GcpZone::AsiaEast2B),
            "asia-east2-c" => Ok(GcpZone::AsiaEast2C),
            "asia-northeast1-a" => Ok(GcpZone::AsiaNortheast1A),
            "asia-northeast1-b" => Ok(GcpZone::AsiaNortheast1B),
            "asia-northeast1-c" => Ok(GcpZone::AsiaNortheast1C),
            "asia-northeast2-a" => Ok(GcpZone::AsiaNortheast2A),
            "asia-northeast2-b" => Ok(GcpZone::AsiaNortheast2B),
            "asia-northeast2-c" => Ok(GcpZone::AsiaNortheast2C),
            "asia-northeast3-a" => Ok(GcpZone::AsiaNortheast3A),
            "asia-northeast3-b" => Ok(GcpZone::AsiaNortheast3B),
            "asia-northeast3-c" => Ok(GcpZone::AsiaNortheast3C),
            "asia-south1-a" => Ok(GcpZone::AsiaSouth1A),
            "asia-south1-b" => Ok(GcpZone::AsiaSouth1B),
            "asia-south1-c" => Ok(GcpZone::AsiaSouth1C),
            "asia-south2-a" => Ok(GcpZone::AsiaSouth2A),
            "asia-south2-b" => Ok(GcpZone::AsiaSouth2B),
            "asia-south2-c" => Ok(GcpZone::AsiaSouth2C),
            "asia-southeast1-a" => Ok(GcpZone::AsiaSoutheast1A),
            "asia-southeast1-b" => Ok(GcpZone::AsiaSoutheast1B),
            "asia-southeast1-c" => Ok(GcpZone::AsiaSoutheast1C),
            "asia-southeast2-a" => Ok(GcpZone::AsiaSoutheast2A),
            "asia-southeast2-b" => Ok(GcpZone::AsiaSoutheast2B),
            "asia-southeast2-c" => Ok(GcpZone::AsiaSoutheast2C),
            "australia-southeast1-a" => Ok(GcpZone::AustraliaSoutheast1A),
            "australia-southeast1-b" => Ok(GcpZone::AustraliaSoutheast1B),
            "australia-southeast1-c" => Ok(GcpZone::AustraliaSoutheast1C),
            "australia-southeast2-a" => Ok(GcpZone::AustraliaSoutheast2A),
            "australia-southeast2-b" => Ok(GcpZone::AustraliaSoutheast2B),
            "australia-southeast2-c" => Ok(GcpZone::AustraliaSoutheast2C),
            "europe-central2-a" => Ok(GcpZone::EuropeCentral2A),
            "europe-central2-b" => Ok(GcpZone::EuropeCentral2B),
            "europe-central2-c" => Ok(GcpZone::EuropeCentral2C),
            "europe-north1-a" => Ok(GcpZone::EuropeNorth1A),
            "europe-north1-b" => Ok(GcpZone::EuropeNorth1B),
            "europe-north1-c" => Ok(GcpZone::EuropeNorth1C),
            "europe-southwest1-a" => Ok(GcpZone::EuropeSouthwest1A),
            "europe-southwest1-b" => Ok(GcpZone::EuropeSouthwest1B),
            "europe-southwest1-c" => Ok(GcpZone::EuropeSouthwest1C),
            "europe-west10-a" => Ok(GcpZone::EuropeWest10A),
            "europe-west10-b" => Ok(GcpZone::EuropeWest10B),
            "europe-west10-c" => Ok(GcpZone::EuropeWest10C),
            "europe-west12-a" => Ok(GcpZone::EuropeWest12A),
            "europe-west12-b" => Ok(GcpZone::EuropeWest12B),
            "europe-west12-c" => Ok(GcpZone::EuropeWest12C),
            "europe-west1-b" => Ok(GcpZone::EuropeWest1B),
            "europe-west1-c" => Ok(GcpZone::EuropeWest1C),
            "europe-west1-d" => Ok(GcpZone::EuropeWest1D),
            "europe-west2-a" => Ok(GcpZone::EuropeWest2A),
            "europe-west2-b" => Ok(GcpZone::EuropeWest2B),
            "europe-west2-c" => Ok(GcpZone::EuropeWest2C),
            "europe-west3-a" => Ok(GcpZone::EuropeWest3A),
            "europe-west3-b" => Ok(GcpZone::EuropeWest3B),
            "europe-west3-c" => Ok(GcpZone::EuropeWest3C),
            "europe-west4-a" => Ok(GcpZone::EuropeWest4A),
            "europe-west4-b" => Ok(GcpZone::EuropeWest4B),
            "europe-west4-c" => Ok(GcpZone::EuropeWest4C),
            "europe-west6-a" => Ok(GcpZone::EuropeWest6A),
            "europe-west6-b" => Ok(GcpZone::EuropeWest6B),
            "europe-west6-c" => Ok(GcpZone::EuropeWest6C),
            "europe-west8-a" => Ok(GcpZone::EuropeWest8A),
            "europe-west8-b" => Ok(GcpZone::EuropeWest8B),
            "europe-west8-c" => Ok(GcpZone::EuropeWest8C),
            "europe-west9-a" => Ok(GcpZone::EuropeWest9A),
            "europe-west9-b" => Ok(GcpZone::EuropeWest9B),
            "europe-west9-c" => Ok(GcpZone::EuropeWest9C),
            "me-central1-a" => Ok(GcpZone::MeCentral1A),
            "me-central1-b" => Ok(GcpZone::MeCentral1B),
            "me-central1-c" => Ok(GcpZone::MeCentral1C),
            "me-central2-a" => Ok(GcpZone::MeCentral2A),
            "me-central2-b" => Ok(GcpZone::MeCentral2B),
            "me-central2-c" => Ok(GcpZone::MeCentral2C),
            "me-west1-a" => Ok(GcpZone::MeWest1A),
            "me-west1-b" => Ok(GcpZone::MeWest1B),
            "me-west1-c" => Ok(GcpZone::MeWest1C),
            "northamerica-northeast1-a" => Ok(GcpZone::NorthAmericaNortheast1A),
            "northamerica-northeast1-b" => Ok(GcpZone::NorthAmericaNortheast1B),
            "northamerica-northeast1-c" => Ok(GcpZone::NorthAmericaNortheast1C),
            "northamerica-northeast2-a" => Ok(GcpZone::NorthAmericaNortheast2A),
            "northamerica-northeast2-b" => Ok(GcpZone::NorthAmericaNortheast2B),
            "northamerica-northeast2-c" => Ok(GcpZone::NorthAmericaNortheast2C),
            "southamerica-east1-a" => Ok(GcpZone::SouthAmericaEast1A),
            "southamerica-east1-b" => Ok(GcpZone::SouthAmericaEast1B),
            "southamerica-east1-c" => Ok(GcpZone::SouthAmericaEast1C),
            "southamerica-west1-a" => Ok(GcpZone::SouthAmericaWest1A),
            "southamerica-west1-b" => Ok(GcpZone::SouthAmericaWest1B),
            "southamerica-west1-c" => Ok(GcpZone::SouthAmericaWest1C),
            "us-central1-a" => Ok(GcpZone::UsCentral1A),
            "us-central1-b" => Ok(GcpZone::UsCentral1B),
            "us-central1-c" => Ok(GcpZone::UsCentral1C),
            "us-central1-f" => Ok(GcpZone::UsCentral1F),
            "us-east1-b" => Ok(GcpZone::UsEast1B),
            "us-east1-c" => Ok(GcpZone::UsEast1C),
            "us-east1-d" => Ok(GcpZone::UsEast1D),
            "us-east4-a" => Ok(GcpZone::UsEast4A),
            "us-east4-b" => Ok(GcpZone::UsEast4B),
            "us-east4-c" => Ok(GcpZone::UsEast4C),
            "us-east5-a" => Ok(GcpZone::UsEast5A),
            "us-east5-b" => Ok(GcpZone::UsEast5B),
            "us-east5-c" => Ok(GcpZone::UsEast5C),
            "us-south1-a" => Ok(GcpZone::UsSouth1A),
            "us-south1-b" => Ok(GcpZone::UsSouth1B),
            "us-south1-c" => Ok(GcpZone::UsSouth1C),
            "us-west1-a" => Ok(GcpZone::UsWest1A),
            "us-west1-b" => Ok(GcpZone::UsWest1B),
            "us-west1-c" => Ok(GcpZone::UsWest1C),
            "us-west2-a" => Ok(GcpZone::UsWest2A),
            "us-west2-b" => Ok(GcpZone::UsWest2B),
            "us-west2-c" => Ok(GcpZone::UsWest2C),
            "us-west3-a" => Ok(GcpZone::UsWest3A),
            "us-west3-b" => Ok(GcpZone::UsWest3B),
            "us-west3-c" => Ok(GcpZone::UsWest3C),
            "us-west4-a" => Ok(GcpZone::UsWest4A),
            "us-west4-b" => Ok(GcpZone::UsWest4B),
            "us-west4-c" => Ok(GcpZone::UsWest4C),
            _ => Err(()),
        }
    }
}

#[derive(Serialize, Deserialize, PartialEq, Eq, Debug, Clone, EnumIter)]
// Sync with Qovery Core team if you update this content
// Formatted regions can be retrieved using this command:
//  gcloud compute regions list --format json | jq -r 'map(.name |= (ascii_downcase | gsub("-(?<a>[a-z])"; .a|ascii_upcase))) | .[].name | ./"" | first |= ascii_upcase | add'  | sort
pub enum GcpRegion {
    AsiaEast1,
    AsiaEast2,
    AsiaNortheast1,
    AsiaNortheast2,
    AsiaNortheast3,
    AsiaSouth1,
    AsiaSouth2,
    AsiaSoutheast1,
    AsiaSoutheast2,
    AustraliaSoutheast1,
    AustraliaSoutheast2,
    EuropeCentral2,
    EuropeNorth1,
    EuropeSouthwest1,
    EuropeWest1,
    EuropeWest10,
    EuropeWest12,
    EuropeWest2,
    EuropeWest3,
    EuropeWest4,
    EuropeWest6,
    EuropeWest8,
    EuropeWest9,
    MeCentral1,
    MeCentral2,
    MeWest1,
    NorthAmericaNortheast1,
    NorthAmericaNortheast2,
    SouthAmericaEast1,
    SouthAmericaWest1,
    UsCentral1,
    UsEast1,
    UsEast4,
    UsEast5,
    UsSouth1,
    UsWest1,
    UsWest2,
    UsWest3,
    UsWest4,
}

impl GcpRegion {
    /// Zones for the region
    pub fn zones(&self) -> &[GcpZone] {
        match &self {
            GcpRegion::AsiaEast1 => &[GcpZone::AsiaEast1A, GcpZone::AsiaEast1B, GcpZone::AsiaEast1C],
            GcpRegion::AsiaEast2 => &[GcpZone::AsiaEast2A, GcpZone::AsiaEast2B, GcpZone::AsiaEast2C],
            GcpRegion::AsiaNortheast1 => &[
                GcpZone::AsiaNortheast1A,
                GcpZone::AsiaNortheast1B,
                GcpZone::AsiaNortheast1C,
            ],
            GcpRegion::AsiaNortheast2 => &[
                GcpZone::AsiaNortheast2A,
                GcpZone::AsiaNortheast2B,
                GcpZone::AsiaNortheast2C,
            ],
            GcpRegion::AsiaNortheast3 => &[
                GcpZone::AsiaNortheast3A,
                GcpZone::AsiaNortheast3B,
                GcpZone::AsiaNortheast3C,
            ],
            GcpRegion::AsiaSouth1 => &[GcpZone::AsiaSouth1A, GcpZone::AsiaSouth1B, GcpZone::AsiaSouth1C],
            GcpRegion::AsiaSouth2 => &[GcpZone::AsiaSouth2A, GcpZone::AsiaSouth2B, GcpZone::AsiaSouth2C],
            GcpRegion::AsiaSoutheast1 => &[
                GcpZone::AsiaSoutheast1A,
                GcpZone::AsiaSoutheast1B,
                GcpZone::AsiaSoutheast1C,
            ],
            GcpRegion::AsiaSoutheast2 => &[
                GcpZone::AsiaSoutheast2A,
                GcpZone::AsiaSoutheast2B,
                GcpZone::AsiaSoutheast2C,
            ],
            GcpRegion::AustraliaSoutheast1 => &[
                GcpZone::AustraliaSoutheast1A,
                GcpZone::AustraliaSoutheast1B,
                GcpZone::AustraliaSoutheast1C,
            ],
            GcpRegion::AustraliaSoutheast2 => &[
                GcpZone::AustraliaSoutheast2A,
                GcpZone::AustraliaSoutheast2B,
                GcpZone::AustraliaSoutheast2C,
            ],
            GcpRegion::EuropeCentral2 => &[
                GcpZone::EuropeCentral2A,
                GcpZone::EuropeCentral2B,
                GcpZone::EuropeCentral2C,
            ],
            GcpRegion::EuropeNorth1 => &[GcpZone::EuropeNorth1A, GcpZone::EuropeNorth1B, GcpZone::EuropeNorth1C],
            GcpRegion::EuropeSouthwest1 => &[
                GcpZone::EuropeSouthwest1A,
                GcpZone::EuropeSouthwest1B,
                GcpZone::EuropeSouthwest1C,
            ],
            GcpRegion::EuropeWest1 => &[GcpZone::EuropeWest1B, GcpZone::EuropeWest1C, GcpZone::EuropeWest1D],
            GcpRegion::EuropeWest10 => &[GcpZone::EuropeWest10A, GcpZone::EuropeWest10B, GcpZone::EuropeWest10C],
            GcpRegion::EuropeWest12 => &[GcpZone::EuropeWest12A, GcpZone::EuropeWest12B, GcpZone::EuropeWest12C],
            GcpRegion::EuropeWest2 => &[GcpZone::EuropeWest2A, GcpZone::EuropeWest2B, GcpZone::EuropeWest2C],
            GcpRegion::EuropeWest3 => &[GcpZone::EuropeWest3A, GcpZone::EuropeWest3B, GcpZone::EuropeWest3C],
            GcpRegion::EuropeWest4 => &[GcpZone::EuropeWest4A, GcpZone::EuropeWest4B, GcpZone::EuropeWest4C],
            GcpRegion::EuropeWest6 => &[GcpZone::EuropeWest6A, GcpZone::EuropeWest6B, GcpZone::EuropeWest6C],
            GcpRegion::EuropeWest8 => &[GcpZone::EuropeWest8A, GcpZone::EuropeWest8B, GcpZone::EuropeWest8C],
            GcpRegion::EuropeWest9 => &[GcpZone::EuropeWest9A, GcpZone::EuropeWest9B, GcpZone::EuropeWest9C],
            GcpRegion::MeCentral1 => &[GcpZone::MeCentral1A, GcpZone::MeCentral1B, GcpZone::MeCentral1C],
            GcpRegion::MeCentral2 => &[GcpZone::MeCentral2A, GcpZone::MeCentral2B, GcpZone::MeCentral2C],
            GcpRegion::MeWest1 => &[GcpZone::MeWest1A, GcpZone::MeWest1B, GcpZone::MeWest1C],
            GcpRegion::NorthAmericaNortheast1 => &[
                GcpZone::NorthAmericaNortheast1A,
                GcpZone::NorthAmericaNortheast1B,
                GcpZone::NorthAmericaNortheast1C,
            ],
            GcpRegion::NorthAmericaNortheast2 => &[
                GcpZone::NorthAmericaNortheast2A,
                GcpZone::NorthAmericaNortheast2B,
                GcpZone::NorthAmericaNortheast2C,
            ],
            GcpRegion::SouthAmericaEast1 => &[
                GcpZone::SouthAmericaEast1A,
                GcpZone::SouthAmericaEast1B,
                GcpZone::SouthAmericaEast1C,
            ],
            GcpRegion::SouthAmericaWest1 => &[
                GcpZone::SouthAmericaWest1A,
                GcpZone::SouthAmericaWest1B,
                GcpZone::SouthAmericaWest1C,
            ],
            GcpRegion::UsCentral1 => &[GcpZone::UsCentral1A, GcpZone::UsCentral1B, GcpZone::UsCentral1C],
            GcpRegion::UsEast1 => &[GcpZone::UsEast1B, GcpZone::UsEast1C, GcpZone::UsEast1D],
            GcpRegion::UsEast4 => &[GcpZone::UsEast4A, GcpZone::UsEast4B, GcpZone::UsEast4C],
            GcpRegion::UsEast5 => &[GcpZone::UsEast5A, GcpZone::UsEast5B, GcpZone::UsEast5C],
            GcpRegion::UsSouth1 => &[GcpZone::UsSouth1A, GcpZone::UsSouth1B, GcpZone::UsSouth1C],
            GcpRegion::UsWest1 => &[GcpZone::UsWest1A, GcpZone::UsWest1B, GcpZone::UsWest1C],
            GcpRegion::UsWest2 => &[GcpZone::UsWest2A, GcpZone::UsWest2B, GcpZone::UsWest2C],
            GcpRegion::UsWest3 => &[GcpZone::UsWest3A, GcpZone::UsWest3B, GcpZone::UsWest3C],
            GcpRegion::UsWest4 => &[GcpZone::UsWest4A, GcpZone::UsWest4B, GcpZone::UsWest4C],
        }
    }
}

impl ToCloudProviderFormat for GcpRegion {
    fn to_cloud_provider_format(&self) -> &str {
        match self {
            GcpRegion::AsiaEast1 => "asia-east1",
            GcpRegion::AsiaEast2 => "asia-east2",
            GcpRegion::AsiaNortheast1 => "asia-northeast1",
            GcpRegion::AsiaNortheast2 => "asia-northeast2",
            GcpRegion::AsiaNortheast3 => "asia-northeast3",
            GcpRegion::AsiaSouth1 => "asia-south1",
            GcpRegion::AsiaSouth2 => "asia-south2",
            GcpRegion::AsiaSoutheast1 => "asia-southeast1",
            GcpRegion::AsiaSoutheast2 => "asia-southeast2",
            GcpRegion::AustraliaSoutheast1 => "australia-southeast1",
            GcpRegion::AustraliaSoutheast2 => "australia-southeast2",
            GcpRegion::EuropeCentral2 => "europe-central2",
            GcpRegion::EuropeNorth1 => "europe-north1",
            GcpRegion::EuropeSouthwest1 => "europe-southwest1",
            GcpRegion::EuropeWest1 => "europe-west1",
            GcpRegion::EuropeWest10 => "europe-west10",
            GcpRegion::EuropeWest12 => "europe-west12",
            GcpRegion::EuropeWest2 => "europe-west2",
            GcpRegion::EuropeWest3 => "europe-west3",
            GcpRegion::EuropeWest4 => "europe-west4",
            GcpRegion::EuropeWest6 => "europe-west6",
            GcpRegion::EuropeWest8 => "europe-west8",
            GcpRegion::EuropeWest9 => "europe-west9",
            GcpRegion::MeCentral1 => "me-central1",
            GcpRegion::MeCentral2 => "me-central2",
            GcpRegion::MeWest1 => "me-west1",
            GcpRegion::NorthAmericaNortheast1 => "northamerica-northeast1",
            GcpRegion::NorthAmericaNortheast2 => "northamerica-northeast2",
            GcpRegion::SouthAmericaEast1 => "southamerica-east1",
            GcpRegion::SouthAmericaWest1 => "southamerica-west1",
            GcpRegion::UsCentral1 => "us-central1",
            GcpRegion::UsEast1 => "us-east1",
            GcpRegion::UsEast4 => "us-east4",
            GcpRegion::UsEast5 => "us-east5",
            GcpRegion::UsSouth1 => "us-south1",
            GcpRegion::UsWest1 => "us-west1",
            GcpRegion::UsWest2 => "us-west2",
            GcpRegion::UsWest3 => "us-west3",
            GcpRegion::UsWest4 => "us-west4",
        }
    }
}

impl Display for GcpRegion {
    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.to_cloud_provider_format())
    }
}

impl FromStr for GcpRegion {
    type Err = ();

    fn from_str(s: &str) -> Result<GcpRegion, ()> {
        let v: &str = &s.to_lowercase();
        match v {
            "asia-east1" => Ok(GcpRegion::AsiaEast1),
            "asia-east2" => Ok(GcpRegion::AsiaEast2),
            "asia-northeast1" => Ok(GcpRegion::AsiaNortheast1),
            "asia-northeast2" => Ok(GcpRegion::AsiaNortheast2),
            "asia-northeast3" => Ok(GcpRegion::AsiaNortheast3),
            "asia-south1" => Ok(GcpRegion::AsiaSouth1),
            "asia-south2" => Ok(GcpRegion::AsiaSouth2),
            "asia-southeast1" => Ok(GcpRegion::AsiaSoutheast1),
            "asia-southeast2" => Ok(GcpRegion::AsiaSoutheast2),
            "australia-southeast1" => Ok(GcpRegion::AustraliaSoutheast1),
            "australia-southeast2" => Ok(GcpRegion::AustraliaSoutheast2),
            "europe-central2" => Ok(GcpRegion::EuropeCentral2),
            "europe-north1" => Ok(GcpRegion::EuropeNorth1),
            "europe-southwest1" => Ok(GcpRegion::EuropeSouthwest1),
            "europe-west1" => Ok(GcpRegion::EuropeWest1),
            "europe-west10" => Ok(GcpRegion::EuropeWest10),
            "europe-west12" => Ok(GcpRegion::EuropeWest12),
            "europe-west2" => Ok(GcpRegion::EuropeWest2),
            "europe-west3" => Ok(GcpRegion::EuropeWest3),
            "europe-west4" => Ok(GcpRegion::EuropeWest4),
            "europe-west6" => Ok(GcpRegion::EuropeWest6),
            "europe-west8" => Ok(GcpRegion::EuropeWest8),
            "europe-west9" => Ok(GcpRegion::EuropeWest9),
            "me-central1" => Ok(GcpRegion::MeCentral1),
            "me-central2" => Ok(GcpRegion::MeCentral2),
            "me-west1" => Ok(GcpRegion::MeWest1),
            "northamerica-northeast1" => Ok(GcpRegion::NorthAmericaNortheast1),
            "northamerica-northeast2" => Ok(GcpRegion::NorthAmericaNortheast2),
            "southamerica-east1" => Ok(GcpRegion::SouthAmericaEast1),
            "southamerica-west1" => Ok(GcpRegion::SouthAmericaWest1),
            "us-central1" => Ok(GcpRegion::UsCentral1),
            "us-east1" => Ok(GcpRegion::UsEast1),
            "us-east4" => Ok(GcpRegion::UsEast4),
            "us-east5" => Ok(GcpRegion::UsEast5),
            "us-south1" => Ok(GcpRegion::UsSouth1),
            "us-west1" => Ok(GcpRegion::UsWest1),
            "us-west2" => Ok(GcpRegion::UsWest2),
            "us-west3" => Ok(GcpRegion::UsWest3),
            "us-west4" => Ok(GcpRegion::UsWest4),
            _ => Err(()),
        }
    }
}

#[cfg(test)]
mod tests {
    use crate::environment::models::ToCloudProviderFormat;
    use crate::infrastructure::models::cloud_provider::gcp::locations::{GcpRegion, GcpZone};
    use std::str::FromStr;
    use strum::IntoEnumIterator;

    #[test]
    fn test_gcp_region_to_gcp_format() {
        for region in GcpRegion::iter() {
            assert_eq!(
                match region {
                    GcpRegion::AsiaEast1 => "asia-east1",
                    GcpRegion::AsiaEast2 => "asia-east2",
                    GcpRegion::AsiaNortheast1 => "asia-northeast1",
                    GcpRegion::AsiaNortheast2 => "asia-northeast2",
                    GcpRegion::AsiaNortheast3 => "asia-northeast3",
                    GcpRegion::AsiaSouth1 => "asia-south1",
                    GcpRegion::AsiaSouth2 => "asia-south2",
                    GcpRegion::AsiaSoutheast1 => "asia-southeast1",
                    GcpRegion::AsiaSoutheast2 => "asia-southeast2",
                    GcpRegion::AustraliaSoutheast1 => "australia-southeast1",
                    GcpRegion::AustraliaSoutheast2 => "australia-southeast2",
                    GcpRegion::EuropeCentral2 => "europe-central2",
                    GcpRegion::EuropeNorth1 => "europe-north1",
                    GcpRegion::EuropeSouthwest1 => "europe-southwest1",
                    GcpRegion::EuropeWest1 => "europe-west1",
                    GcpRegion::EuropeWest10 => "europe-west10",
                    GcpRegion::EuropeWest12 => "europe-west12",
                    GcpRegion::EuropeWest2 => "europe-west2",
                    GcpRegion::EuropeWest3 => "europe-west3",
                    GcpRegion::EuropeWest4 => "europe-west4",
                    GcpRegion::EuropeWest6 => "europe-west6",
                    GcpRegion::EuropeWest8 => "europe-west8",
                    GcpRegion::EuropeWest9 => "europe-west9",
                    GcpRegion::MeCentral1 => "me-central1",
                    GcpRegion::MeCentral2 => "me-central2",
                    GcpRegion::MeWest1 => "me-west1",
                    GcpRegion::NorthAmericaNortheast1 => "northamerica-northeast1",
                    GcpRegion::NorthAmericaNortheast2 => "northamerica-northeast2",
                    GcpRegion::SouthAmericaEast1 => "southamerica-east1",
                    GcpRegion::SouthAmericaWest1 => "southamerica-west1",
                    GcpRegion::UsCentral1 => "us-central1",
                    GcpRegion::UsEast1 => "us-east1",
                    GcpRegion::UsEast4 => "us-east4",
                    GcpRegion::UsEast5 => "us-east5",
                    GcpRegion::UsSouth1 => "us-south1",
                    GcpRegion::UsWest1 => "us-west1",
                    GcpRegion::UsWest2 => "us-west2",
                    GcpRegion::UsWest3 => "us-west3",
                    GcpRegion::UsWest4 => "us-west4",
                },
                region.to_cloud_provider_format()
            );
        }
    }

    #[test]
    fn test_gcp_region_zones() {
        for region in GcpRegion::iter() {
            assert_eq!(
                match region {
                    GcpRegion::AsiaEast1 => &[GcpZone::AsiaEast1A, GcpZone::AsiaEast1B, GcpZone::AsiaEast1C],
                    GcpRegion::AsiaEast2 => &[GcpZone::AsiaEast2A, GcpZone::AsiaEast2B, GcpZone::AsiaEast2C],
                    GcpRegion::AsiaNortheast1 => &[
                        GcpZone::AsiaNortheast1A,
                        GcpZone::AsiaNortheast1B,
                        GcpZone::AsiaNortheast1C,
                    ],
                    GcpRegion::AsiaNortheast2 => &[
                        GcpZone::AsiaNortheast2A,
                        GcpZone::AsiaNortheast2B,
                        GcpZone::AsiaNortheast2C,
                    ],
                    GcpRegion::AsiaNortheast3 => &[
                        GcpZone::AsiaNortheast3A,
                        GcpZone::AsiaNortheast3B,
                        GcpZone::AsiaNortheast3C,
                    ],
                    GcpRegion::AsiaSouth1 => &[GcpZone::AsiaSouth1A, GcpZone::AsiaSouth1B, GcpZone::AsiaSouth1C],
                    GcpRegion::AsiaSouth2 => &[GcpZone::AsiaSouth2A, GcpZone::AsiaSouth2B, GcpZone::AsiaSouth2C],
                    GcpRegion::AsiaSoutheast1 => &[
                        GcpZone::AsiaSoutheast1A,
                        GcpZone::AsiaSoutheast1B,
                        GcpZone::AsiaSoutheast1C,
                    ],
                    GcpRegion::AsiaSoutheast2 => &[
                        GcpZone::AsiaSoutheast2A,
                        GcpZone::AsiaSoutheast2B,
                        GcpZone::AsiaSoutheast2C,
                    ],
                    GcpRegion::AustraliaSoutheast1 => &[
                        GcpZone::AustraliaSoutheast1A,
                        GcpZone::AustraliaSoutheast1B,
                        GcpZone::AustraliaSoutheast1C,
                    ],
                    GcpRegion::AustraliaSoutheast2 => &[
                        GcpZone::AustraliaSoutheast2A,
                        GcpZone::AustraliaSoutheast2B,
                        GcpZone::AustraliaSoutheast2C,
                    ],
                    GcpRegion::EuropeCentral2 => &[
                        GcpZone::EuropeCentral2A,
                        GcpZone::EuropeCentral2B,
                        GcpZone::EuropeCentral2C,
                    ],
                    GcpRegion::EuropeNorth1 =>
                        &[GcpZone::EuropeNorth1A, GcpZone::EuropeNorth1B, GcpZone::EuropeNorth1C],
                    GcpRegion::EuropeSouthwest1 => &[
                        GcpZone::EuropeSouthwest1A,
                        GcpZone::EuropeSouthwest1B,
                        GcpZone::EuropeSouthwest1C,
                    ],
                    GcpRegion::EuropeWest1 => &[GcpZone::EuropeWest1B, GcpZone::EuropeWest1C, GcpZone::EuropeWest1D],
                    GcpRegion::EuropeWest10 =>
                        &[GcpZone::EuropeWest10A, GcpZone::EuropeWest10B, GcpZone::EuropeWest10C],
                    GcpRegion::EuropeWest12 =>
                        &[GcpZone::EuropeWest12A, GcpZone::EuropeWest12B, GcpZone::EuropeWest12C],
                    GcpRegion::EuropeWest2 => &[GcpZone::EuropeWest2A, GcpZone::EuropeWest2B, GcpZone::EuropeWest2C],
                    GcpRegion::EuropeWest3 => &[GcpZone::EuropeWest3A, GcpZone::EuropeWest3B, GcpZone::EuropeWest3C],
                    GcpRegion::EuropeWest4 => &[GcpZone::EuropeWest4A, GcpZone::EuropeWest4B, GcpZone::EuropeWest4C],
                    GcpRegion::EuropeWest6 => &[GcpZone::EuropeWest6A, GcpZone::EuropeWest6B, GcpZone::EuropeWest6C],
                    GcpRegion::EuropeWest8 => &[GcpZone::EuropeWest8A, GcpZone::EuropeWest8B, GcpZone::EuropeWest8C],
                    GcpRegion::EuropeWest9 => &[GcpZone::EuropeWest9A, GcpZone::EuropeWest9B, GcpZone::EuropeWest9C],
                    GcpRegion::MeCentral1 => &[GcpZone::MeCentral1A, GcpZone::MeCentral1B, GcpZone::MeCentral1C],
                    GcpRegion::MeCentral2 => &[GcpZone::MeCentral2A, GcpZone::MeCentral2B, GcpZone::MeCentral2C],
                    GcpRegion::MeWest1 => &[GcpZone::MeWest1A, GcpZone::MeWest1B, GcpZone::MeWest1C],
                    GcpRegion::NorthAmericaNortheast1 => &[
                        GcpZone::NorthAmericaNortheast1A,
                        GcpZone::NorthAmericaNortheast1B,
                        GcpZone::NorthAmericaNortheast1C,
                    ],
                    GcpRegion::NorthAmericaNortheast2 => &[
                        GcpZone::NorthAmericaNortheast2A,
                        GcpZone::NorthAmericaNortheast2B,
                        GcpZone::NorthAmericaNortheast2C,
                    ],
                    GcpRegion::SouthAmericaEast1 => &[
                        GcpZone::SouthAmericaEast1A,
                        GcpZone::SouthAmericaEast1B,
                        GcpZone::SouthAmericaEast1C,
                    ],
                    GcpRegion::SouthAmericaWest1 => &[
                        GcpZone::SouthAmericaWest1A,
                        GcpZone::SouthAmericaWest1B,
                        GcpZone::SouthAmericaWest1C,
                    ],
                    GcpRegion::UsCentral1 => &[GcpZone::UsCentral1A, GcpZone::UsCentral1B, GcpZone::UsCentral1C],
                    GcpRegion::UsEast1 => &[GcpZone::UsEast1B, GcpZone::UsEast1C, GcpZone::UsEast1D],
                    GcpRegion::UsEast4 => &[GcpZone::UsEast4A, GcpZone::UsEast4B, GcpZone::UsEast4C],
                    GcpRegion::UsEast5 => &[GcpZone::UsEast5A, GcpZone::UsEast5B, GcpZone::UsEast5C],
                    GcpRegion::UsSouth1 => &[GcpZone::UsSouth1A, GcpZone::UsSouth1B, GcpZone::UsSouth1C],
                    GcpRegion::UsWest1 => &[GcpZone::UsWest1A, GcpZone::UsWest1B, GcpZone::UsWest1C],
                    GcpRegion::UsWest2 => &[GcpZone::UsWest2A, GcpZone::UsWest2B, GcpZone::UsWest2C],
                    GcpRegion::UsWest3 => &[GcpZone::UsWest3A, GcpZone::UsWest3B, GcpZone::UsWest3C],
                    GcpRegion::UsWest4 => &[GcpZone::UsWest4A, GcpZone::UsWest4B, GcpZone::UsWest4C],
                },
                region.zones()
            );
        }
    }

    #[test]
    fn test_gcp_region_to_string() {
        for region in GcpRegion::iter() {
            assert_eq!(
                match region {
                    GcpRegion::AsiaEast1 => "asia-east1",
                    GcpRegion::AsiaEast2 => "asia-east2",
                    GcpRegion::AsiaNortheast1 => "asia-northeast1",
                    GcpRegion::AsiaNortheast2 => "asia-northeast2",
                    GcpRegion::AsiaNortheast3 => "asia-northeast3",
                    GcpRegion::AsiaSouth1 => "asia-south1",
                    GcpRegion::AsiaSouth2 => "asia-south2",
                    GcpRegion::AsiaSoutheast1 => "asia-southeast1",
                    GcpRegion::AsiaSoutheast2 => "asia-southeast2",
                    GcpRegion::AustraliaSoutheast1 => "australia-southeast1",
                    GcpRegion::AustraliaSoutheast2 => "australia-southeast2",
                    GcpRegion::EuropeCentral2 => "europe-central2",
                    GcpRegion::EuropeNorth1 => "europe-north1",
                    GcpRegion::EuropeSouthwest1 => "europe-southwest1",
                    GcpRegion::EuropeWest1 => "europe-west1",
                    GcpRegion::EuropeWest10 => "europe-west10",
                    GcpRegion::EuropeWest12 => "europe-west12",
                    GcpRegion::EuropeWest2 => "europe-west2",
                    GcpRegion::EuropeWest3 => "europe-west3",
                    GcpRegion::EuropeWest4 => "europe-west4",
                    GcpRegion::EuropeWest6 => "europe-west6",
                    GcpRegion::EuropeWest8 => "europe-west8",
                    GcpRegion::EuropeWest9 => "europe-west9",
                    GcpRegion::MeCentral1 => "me-central1",
                    GcpRegion::MeCentral2 => "me-central2",
                    GcpRegion::MeWest1 => "me-west1",
                    GcpRegion::NorthAmericaNortheast1 => "northamerica-northeast1",
                    GcpRegion::NorthAmericaNortheast2 => "northamerica-northeast2",
                    GcpRegion::SouthAmericaEast1 => "southamerica-east1",
                    GcpRegion::SouthAmericaWest1 => "southamerica-west1",
                    GcpRegion::UsCentral1 => "us-central1",
                    GcpRegion::UsEast1 => "us-east1",
                    GcpRegion::UsEast4 => "us-east4",
                    GcpRegion::UsEast5 => "us-east5",
                    GcpRegion::UsSouth1 => "us-south1",
                    GcpRegion::UsWest1 => "us-west1",
                    GcpRegion::UsWest2 => "us-west2",
                    GcpRegion::UsWest3 => "us-west3",
                    GcpRegion::UsWest4 => "us-west4",
                },
                region.to_string()
            );
        }
    }

    #[test]
    fn test_gcp_region_from_str() {
        // test all supported regions
        for region in GcpRegion::iter() {
            assert_eq!(region, GcpRegion::from_str(region.to_cloud_provider_format()).unwrap());
        }

        // test unsupported region
        assert!(GcpRegion::from_str("an-unsupported-region").is_err());
    }

    #[test]
    fn test_gcp_zone_to_gcp_format() {
        for zone in GcpZone::iter() {
            assert_eq!(
                match zone {
                    GcpZone::AsiaEast1A => "asia-east1-a",
                    GcpZone::AsiaEast1B => "asia-east1-b",
                    GcpZone::AsiaEast1C => "asia-east1-c",
                    GcpZone::AsiaEast2A => "asia-east2-a",
                    GcpZone::AsiaEast2B => "asia-east2-b",
                    GcpZone::AsiaEast2C => "asia-east2-c",
                    GcpZone::AsiaNortheast1A => "asia-northeast1-a",
                    GcpZone::AsiaNortheast1B => "asia-northeast1-b",
                    GcpZone::AsiaNortheast1C => "asia-northeast1-c",
                    GcpZone::AsiaNortheast2A => "asia-northeast2-a",
                    GcpZone::AsiaNortheast2B => "asia-northeast2-b",
                    GcpZone::AsiaNortheast2C => "asia-northeast2-c",
                    GcpZone::AsiaNortheast3A => "asia-northeast3-a",
                    GcpZone::AsiaNortheast3B => "asia-northeast3-b",
                    GcpZone::AsiaNortheast3C => "asia-northeast3-c",
                    GcpZone::AsiaSouth1A => "asia-south1-a",
                    GcpZone::AsiaSouth1B => "asia-south1-b",
                    GcpZone::AsiaSouth1C => "asia-south1-c",
                    GcpZone::AsiaSouth2A => "asia-south2-a",
                    GcpZone::AsiaSouth2B => "asia-south2-b",
                    GcpZone::AsiaSouth2C => "asia-south2-c",
                    GcpZone::AsiaSoutheast1A => "asia-southeast1-a",
                    GcpZone::AsiaSoutheast1B => "asia-southeast1-b",
                    GcpZone::AsiaSoutheast1C => "asia-southeast1-c",
                    GcpZone::AsiaSoutheast2A => "asia-southeast2-a",
                    GcpZone::AsiaSoutheast2B => "asia-southeast2-b",
                    GcpZone::AsiaSoutheast2C => "asia-southeast2-c",
                    GcpZone::AustraliaSoutheast1A => "australia-southeast1-a",
                    GcpZone::AustraliaSoutheast1B => "australia-southeast1-b",
                    GcpZone::AustraliaSoutheast1C => "australia-southeast1-c",
                    GcpZone::AustraliaSoutheast2A => "australia-southeast2-a",
                    GcpZone::AustraliaSoutheast2B => "australia-southeast2-b",
                    GcpZone::AustraliaSoutheast2C => "australia-southeast2-c",
                    GcpZone::EuropeCentral2A => "europe-central2-a",
                    GcpZone::EuropeCentral2B => "europe-central2-b",
                    GcpZone::EuropeCentral2C => "europe-central2-c",
                    GcpZone::EuropeNorth1A => "europe-north1-a",
                    GcpZone::EuropeNorth1B => "europe-north1-b",
                    GcpZone::EuropeNorth1C => "europe-north1-c",
                    GcpZone::EuropeSouthwest1A => "europe-southwest1-a",
                    GcpZone::EuropeSouthwest1B => "europe-southwest1-b",
                    GcpZone::EuropeSouthwest1C => "europe-southwest1-c",
                    GcpZone::EuropeWest10A => "europe-west10-a",
                    GcpZone::EuropeWest10B => "europe-west10-b",
                    GcpZone::EuropeWest10C => "europe-west10-c",
                    GcpZone::EuropeWest12A => "europe-west12-a",
                    GcpZone::EuropeWest12B => "europe-west12-b",
                    GcpZone::EuropeWest12C => "europe-west12-c",
                    GcpZone::EuropeWest1B => "europe-west1-b",
                    GcpZone::EuropeWest1C => "europe-west1-c",
                    GcpZone::EuropeWest1D => "europe-west1-d",
                    GcpZone::EuropeWest2A => "europe-west2-a",
                    GcpZone::EuropeWest2B => "europe-west2-b",
                    GcpZone::EuropeWest2C => "europe-west2-c",
                    GcpZone::EuropeWest3A => "europe-west3-a",
                    GcpZone::EuropeWest3B => "europe-west3-b",
                    GcpZone::EuropeWest3C => "europe-west3-c",
                    GcpZone::EuropeWest4A => "europe-west4-a",
                    GcpZone::EuropeWest4B => "europe-west4-b",
                    GcpZone::EuropeWest4C => "europe-west4-c",
                    GcpZone::EuropeWest6A => "europe-west6-a",
                    GcpZone::EuropeWest6B => "europe-west6-b",
                    GcpZone::EuropeWest6C => "europe-west6-c",
                    GcpZone::EuropeWest8A => "europe-west8-a",
                    GcpZone::EuropeWest8B => "europe-west8-b",
                    GcpZone::EuropeWest8C => "europe-west8-c",
                    GcpZone::EuropeWest9A => "europe-west9-a",
                    GcpZone::EuropeWest9B => "europe-west9-b",
                    GcpZone::EuropeWest9C => "europe-west9-c",
                    GcpZone::MeCentral1A => "me-central1-a",
                    GcpZone::MeCentral1B => "me-central1-b",
                    GcpZone::MeCentral1C => "me-central1-c",
                    GcpZone::MeCentral2A => "me-central2-a",
                    GcpZone::MeCentral2B => "me-central2-b",
                    GcpZone::MeCentral2C => "me-central2-c",
                    GcpZone::MeWest1A => "me-west1-a",
                    GcpZone::MeWest1B => "me-west1-b",
                    GcpZone::MeWest1C => "me-west1-c",
                    GcpZone::NorthAmericaNortheast1A => "northamerica-northeast1-a",
                    GcpZone::NorthAmericaNortheast1B => "northamerica-northeast1-b",
                    GcpZone::NorthAmericaNortheast1C => "northamerica-northeast1-c",
                    GcpZone::NorthAmericaNortheast2A => "northamerica-northeast2-a",
                    GcpZone::NorthAmericaNortheast2B => "northamerica-northeast2-b",
                    GcpZone::NorthAmericaNortheast2C => "northamerica-northeast2-c",
                    GcpZone::SouthAmericaEast1A => "southamerica-east1-a",
                    GcpZone::SouthAmericaEast1B => "southamerica-east1-b",
                    GcpZone::SouthAmericaEast1C => "southamerica-east1-c",
                    GcpZone::SouthAmericaWest1A => "southamerica-west1-a",
                    GcpZone::SouthAmericaWest1B => "southamerica-west1-b",
                    GcpZone::SouthAmericaWest1C => "southamerica-west1-c",
                    GcpZone::UsCentral1A => "us-central1-a",
                    GcpZone::UsCentral1B => "us-central1-b",
                    GcpZone::UsCentral1C => "us-central1-c",
                    GcpZone::UsCentral1F => "us-central1-f",
                    GcpZone::UsEast1B => "us-east1-b",
                    GcpZone::UsEast1C => "us-east1-c",
                    GcpZone::UsEast1D => "us-east1-d",
                    GcpZone::UsEast4A => "us-east4-a",
                    GcpZone::UsEast4B => "us-east4-b",
                    GcpZone::UsEast4C => "us-east4-c",
                    GcpZone::UsEast5A => "us-east5-a",
                    GcpZone::UsEast5B => "us-east5-b",
                    GcpZone::UsEast5C => "us-east5-c",
                    GcpZone::UsSouth1A => "us-south1-a",
                    GcpZone::UsSouth1B => "us-south1-b",
                    GcpZone::UsSouth1C => "us-south1-c",
                    GcpZone::UsWest1A => "us-west1-a",
                    GcpZone::UsWest1B => "us-west1-b",
                    GcpZone::UsWest1C => "us-west1-c",
                    GcpZone::UsWest2A => "us-west2-a",
                    GcpZone::UsWest2B => "us-west2-b",
                    GcpZone::UsWest2C => "us-west2-c",
                    GcpZone::UsWest3A => "us-west3-a",
                    GcpZone::UsWest3B => "us-west3-b",
                    GcpZone::UsWest3C => "us-west3-c",
                    GcpZone::UsWest4A => "us-west4-a",
                    GcpZone::UsWest4B => "us-west4-b",
                    GcpZone::UsWest4C => "us-west4-c",
                },
                zone.to_cloud_provider_format()
            );
        }
    }

    #[test]
    fn test_gcp_zone_region() {
        for zone in GcpZone::iter() {
            assert_eq!(
                match zone {
                    GcpZone::AsiaEast1A => GcpRegion::AsiaEast1,
                    GcpZone::AsiaEast1B => GcpRegion::AsiaEast1,
                    GcpZone::AsiaEast1C => GcpRegion::AsiaEast1,
                    GcpZone::AsiaEast2A => GcpRegion::AsiaEast2,
                    GcpZone::AsiaEast2B => GcpRegion::AsiaEast2,
                    GcpZone::AsiaEast2C => GcpRegion::AsiaEast2,
                    GcpZone::AsiaNortheast1A => GcpRegion::AsiaNortheast1,
                    GcpZone::AsiaNortheast1B => GcpRegion::AsiaNortheast1,
                    GcpZone::AsiaNortheast1C => GcpRegion::AsiaNortheast1,
                    GcpZone::AsiaNortheast2A => GcpRegion::AsiaNortheast2,
                    GcpZone::AsiaNortheast2B => GcpRegion::AsiaNortheast2,
                    GcpZone::AsiaNortheast2C => GcpRegion::AsiaNortheast2,
                    GcpZone::AsiaNortheast3A => GcpRegion::AsiaNortheast3,
                    GcpZone::AsiaNortheast3B => GcpRegion::AsiaNortheast3,
                    GcpZone::AsiaNortheast3C => GcpRegion::AsiaNortheast3,
                    GcpZone::AsiaSouth1A => GcpRegion::AsiaSouth1,
                    GcpZone::AsiaSouth1B => GcpRegion::AsiaSouth1,
                    GcpZone::AsiaSouth1C => GcpRegion::AsiaSouth1,
                    GcpZone::AsiaSouth2A => GcpRegion::AsiaSouth2,
                    GcpZone::AsiaSouth2B => GcpRegion::AsiaSouth2,
                    GcpZone::AsiaSouth2C => GcpRegion::AsiaSouth2,
                    GcpZone::AsiaSoutheast1A => GcpRegion::AsiaSoutheast1,
                    GcpZone::AsiaSoutheast1B => GcpRegion::AsiaSoutheast1,
                    GcpZone::AsiaSoutheast1C => GcpRegion::AsiaSoutheast1,
                    GcpZone::AsiaSoutheast2A => GcpRegion::AsiaSoutheast2,
                    GcpZone::AsiaSoutheast2B => GcpRegion::AsiaSoutheast2,
                    GcpZone::AsiaSoutheast2C => GcpRegion::AsiaSoutheast2,
                    GcpZone::AustraliaSoutheast1A => GcpRegion::AustraliaSoutheast1,
                    GcpZone::AustraliaSoutheast1B => GcpRegion::AustraliaSoutheast1,
                    GcpZone::AustraliaSoutheast1C => GcpRegion::AustraliaSoutheast1,
                    GcpZone::AustraliaSoutheast2A => GcpRegion::AustraliaSoutheast2,
                    GcpZone::AustraliaSoutheast2B => GcpRegion::AustraliaSoutheast2,
                    GcpZone::AustraliaSoutheast2C => GcpRegion::AustraliaSoutheast2,
                    GcpZone::EuropeCentral2A => GcpRegion::EuropeCentral2,
                    GcpZone::EuropeCentral2B => GcpRegion::EuropeCentral2,
                    GcpZone::EuropeCentral2C => GcpRegion::EuropeCentral2,
                    GcpZone::EuropeNorth1A => GcpRegion::EuropeNorth1,
                    GcpZone::EuropeNorth1B => GcpRegion::EuropeNorth1,
                    GcpZone::EuropeNorth1C => GcpRegion::EuropeNorth1,
                    GcpZone::EuropeSouthwest1A => GcpRegion::EuropeSouthwest1,
                    GcpZone::EuropeSouthwest1B => GcpRegion::EuropeSouthwest1,
                    GcpZone::EuropeSouthwest1C => GcpRegion::EuropeSouthwest1,
                    GcpZone::EuropeWest10A => GcpRegion::EuropeWest10,
                    GcpZone::EuropeWest10B => GcpRegion::EuropeWest10,
                    GcpZone::EuropeWest10C => GcpRegion::EuropeWest10,
                    GcpZone::EuropeWest12A => GcpRegion::EuropeWest12,
                    GcpZone::EuropeWest12B => GcpRegion::EuropeWest12,
                    GcpZone::EuropeWest12C => GcpRegion::EuropeWest12,
                    GcpZone::EuropeWest1B => GcpRegion::EuropeWest1,
                    GcpZone::EuropeWest1C => GcpRegion::EuropeWest1,
                    GcpZone::EuropeWest1D => GcpRegion::EuropeWest1,
                    GcpZone::EuropeWest2A => GcpRegion::EuropeWest2,
                    GcpZone::EuropeWest2B => GcpRegion::EuropeWest2,
                    GcpZone::EuropeWest2C => GcpRegion::EuropeWest2,
                    GcpZone::EuropeWest3A => GcpRegion::EuropeWest3,
                    GcpZone::EuropeWest3B => GcpRegion::EuropeWest3,
                    GcpZone::EuropeWest3C => GcpRegion::EuropeWest3,
                    GcpZone::EuropeWest4A => GcpRegion::EuropeWest4,
                    GcpZone::EuropeWest4B => GcpRegion::EuropeWest4,
                    GcpZone::EuropeWest4C => GcpRegion::EuropeWest4,
                    GcpZone::EuropeWest6A => GcpRegion::EuropeWest6,
                    GcpZone::EuropeWest6B => GcpRegion::EuropeWest6,
                    GcpZone::EuropeWest6C => GcpRegion::EuropeWest6,
                    GcpZone::EuropeWest8A => GcpRegion::EuropeWest8,
                    GcpZone::EuropeWest8B => GcpRegion::EuropeWest8,
                    GcpZone::EuropeWest8C => GcpRegion::EuropeWest8,
                    GcpZone::EuropeWest9A => GcpRegion::EuropeWest9,
                    GcpZone::EuropeWest9B => GcpRegion::EuropeWest9,
                    GcpZone::EuropeWest9C => GcpRegion::EuropeWest9,
                    GcpZone::MeCentral1A => GcpRegion::MeCentral1,
                    GcpZone::MeCentral1B => GcpRegion::MeCentral1,
                    GcpZone::MeCentral1C => GcpRegion::MeCentral1,
                    GcpZone::MeCentral2A => GcpRegion::MeCentral2,
                    GcpZone::MeCentral2B => GcpRegion::MeCentral2,
                    GcpZone::MeCentral2C => GcpRegion::MeCentral2,
                    GcpZone::MeWest1A => GcpRegion::MeWest1,
                    GcpZone::MeWest1B => GcpRegion::MeWest1,
                    GcpZone::MeWest1C => GcpRegion::MeWest1,
                    GcpZone::NorthAmericaNortheast1A => GcpRegion::NorthAmericaNortheast1,
                    GcpZone::NorthAmericaNortheast1B => GcpRegion::NorthAmericaNortheast1,
                    GcpZone::NorthAmericaNortheast1C => GcpRegion::NorthAmericaNortheast1,
                    GcpZone::NorthAmericaNortheast2A => GcpRegion::NorthAmericaNortheast2,
                    GcpZone::NorthAmericaNortheast2B => GcpRegion::NorthAmericaNortheast2,
                    GcpZone::NorthAmericaNortheast2C => GcpRegion::NorthAmericaNortheast2,
                    GcpZone::SouthAmericaEast1A => GcpRegion::SouthAmericaEast1,
                    GcpZone::SouthAmericaEast1B => GcpRegion::SouthAmericaEast1,
                    GcpZone::SouthAmericaEast1C => GcpRegion::SouthAmericaEast1,
                    GcpZone::SouthAmericaWest1A => GcpRegion::SouthAmericaWest1,
                    GcpZone::SouthAmericaWest1B => GcpRegion::SouthAmericaWest1,
                    GcpZone::SouthAmericaWest1C => GcpRegion::SouthAmericaWest1,
                    GcpZone::UsCentral1A => GcpRegion::UsCentral1,
                    GcpZone::UsCentral1B => GcpRegion::UsCentral1,
                    GcpZone::UsCentral1C => GcpRegion::UsCentral1,
                    GcpZone::UsCentral1F => GcpRegion::UsCentral1,
                    GcpZone::UsEast1B => GcpRegion::UsEast1,
                    GcpZone::UsEast1C => GcpRegion::UsEast1,
                    GcpZone::UsEast1D => GcpRegion::UsEast1,
                    GcpZone::UsEast4A => GcpRegion::UsEast4,
                    GcpZone::UsEast4B => GcpRegion::UsEast4,
                    GcpZone::UsEast4C => GcpRegion::UsEast4,
                    GcpZone::UsEast5A => GcpRegion::UsEast5,
                    GcpZone::UsEast5B => GcpRegion::UsEast5,
                    GcpZone::UsEast5C => GcpRegion::UsEast5,
                    GcpZone::UsSouth1A => GcpRegion::UsSouth1,
                    GcpZone::UsSouth1B => GcpRegion::UsSouth1,
                    GcpZone::UsSouth1C => GcpRegion::UsSouth1,
                    GcpZone::UsWest1A => GcpRegion::UsWest1,
                    GcpZone::UsWest1B => GcpRegion::UsWest1,
                    GcpZone::UsWest1C => GcpRegion::UsWest1,
                    GcpZone::UsWest2A => GcpRegion::UsWest2,
                    GcpZone::UsWest2B => GcpRegion::UsWest2,
                    GcpZone::UsWest2C => GcpRegion::UsWest2,
                    GcpZone::UsWest3A => GcpRegion::UsWest3,
                    GcpZone::UsWest3B => GcpRegion::UsWest3,
                    GcpZone::UsWest3C => GcpRegion::UsWest3,
                    GcpZone::UsWest4A => GcpRegion::UsWest4,
                    GcpZone::UsWest4B => GcpRegion::UsWest4,
                    GcpZone::UsWest4C => GcpRegion::UsWest4,
                },
                zone.region()
            );
        }
    }

    #[test]
    fn test_gcp_zone_to_string() {
        for zone in GcpZone::iter() {
            assert_eq!(
                match zone {
                    GcpZone::AsiaEast1A => "asia-east1-a",
                    GcpZone::AsiaEast1B => "asia-east1-b",
                    GcpZone::AsiaEast1C => "asia-east1-c",
                    GcpZone::AsiaEast2A => "asia-east2-a",
                    GcpZone::AsiaEast2B => "asia-east2-b",
                    GcpZone::AsiaEast2C => "asia-east2-c",
                    GcpZone::AsiaNortheast1A => "asia-northeast1-a",
                    GcpZone::AsiaNortheast1B => "asia-northeast1-b",
                    GcpZone::AsiaNortheast1C => "asia-northeast1-c",
                    GcpZone::AsiaNortheast2A => "asia-northeast2-a",
                    GcpZone::AsiaNortheast2B => "asia-northeast2-b",
                    GcpZone::AsiaNortheast2C => "asia-northeast2-c",
                    GcpZone::AsiaNortheast3A => "asia-northeast3-a",
                    GcpZone::AsiaNortheast3B => "asia-northeast3-b",
                    GcpZone::AsiaNortheast3C => "asia-northeast3-c",
                    GcpZone::AsiaSouth1A => "asia-south1-a",
                    GcpZone::AsiaSouth1B => "asia-south1-b",
                    GcpZone::AsiaSouth1C => "asia-south1-c",
                    GcpZone::AsiaSouth2A => "asia-south2-a",
                    GcpZone::AsiaSouth2B => "asia-south2-b",
                    GcpZone::AsiaSouth2C => "asia-south2-c",
                    GcpZone::AsiaSoutheast1A => "asia-southeast1-a",
                    GcpZone::AsiaSoutheast1B => "asia-southeast1-b",
                    GcpZone::AsiaSoutheast1C => "asia-southeast1-c",
                    GcpZone::AsiaSoutheast2A => "asia-southeast2-a",
                    GcpZone::AsiaSoutheast2B => "asia-southeast2-b",
                    GcpZone::AsiaSoutheast2C => "asia-southeast2-c",
                    GcpZone::AustraliaSoutheast1A => "australia-southeast1-a",
                    GcpZone::AustraliaSoutheast1B => "australia-southeast1-b",
                    GcpZone::AustraliaSoutheast1C => "australia-southeast1-c",
                    GcpZone::AustraliaSoutheast2A => "australia-southeast2-a",
                    GcpZone::AustraliaSoutheast2B => "australia-southeast2-b",
                    GcpZone::AustraliaSoutheast2C => "australia-southeast2-c",
                    GcpZone::EuropeCentral2A => "europe-central2-a",
                    GcpZone::EuropeCentral2B => "europe-central2-b",
                    GcpZone::EuropeCentral2C => "europe-central2-c",
                    GcpZone::EuropeNorth1A => "europe-north1-a",
                    GcpZone::EuropeNorth1B => "europe-north1-b",
                    GcpZone::EuropeNorth1C => "europe-north1-c",
                    GcpZone::EuropeSouthwest1A => "europe-southwest1-a",
                    GcpZone::EuropeSouthwest1B => "europe-southwest1-b",
                    GcpZone::EuropeSouthwest1C => "europe-southwest1-c",
                    GcpZone::EuropeWest10A => "europe-west10-a",
                    GcpZone::EuropeWest10B => "europe-west10-b",
                    GcpZone::EuropeWest10C => "europe-west10-c",
                    GcpZone::EuropeWest12A => "europe-west12-a",
                    GcpZone::EuropeWest12B => "europe-west12-b",
                    GcpZone::EuropeWest12C => "europe-west12-c",
                    GcpZone::EuropeWest1B => "europe-west1-b",
                    GcpZone::EuropeWest1C => "europe-west1-c",
                    GcpZone::EuropeWest1D => "europe-west1-d",
                    GcpZone::EuropeWest2A => "europe-west2-a",
                    GcpZone::EuropeWest2B => "europe-west2-b",
                    GcpZone::EuropeWest2C => "europe-west2-c",
                    GcpZone::EuropeWest3A => "europe-west3-a",
                    GcpZone::EuropeWest3B => "europe-west3-b",
                    GcpZone::EuropeWest3C => "europe-west3-c",
                    GcpZone::EuropeWest4A => "europe-west4-a",
                    GcpZone::EuropeWest4B => "europe-west4-b",
                    GcpZone::EuropeWest4C => "europe-west4-c",
                    GcpZone::EuropeWest6A => "europe-west6-a",
                    GcpZone::EuropeWest6B => "europe-west6-b",
                    GcpZone::EuropeWest6C => "europe-west6-c",
                    GcpZone::EuropeWest8A => "europe-west8-a",
                    GcpZone::EuropeWest8B => "europe-west8-b",
                    GcpZone::EuropeWest8C => "europe-west8-c",
                    GcpZone::EuropeWest9A => "europe-west9-a",
                    GcpZone::EuropeWest9B => "europe-west9-b",
                    GcpZone::EuropeWest9C => "europe-west9-c",
                    GcpZone::MeCentral1A => "me-central1-a",
                    GcpZone::MeCentral1B => "me-central1-b",
                    GcpZone::MeCentral1C => "me-central1-c",
                    GcpZone::MeCentral2A => "me-central2-a",
                    GcpZone::MeCentral2B => "me-central2-b",
                    GcpZone::MeCentral2C => "me-central2-c",
                    GcpZone::MeWest1A => "me-west1-a",
                    GcpZone::MeWest1B => "me-west1-b",
                    GcpZone::MeWest1C => "me-west1-c",
                    GcpZone::NorthAmericaNortheast1A => "northamerica-northeast1-a",
                    GcpZone::NorthAmericaNortheast1B => "northamerica-northeast1-b",
                    GcpZone::NorthAmericaNortheast1C => "northamerica-northeast1-c",
                    GcpZone::NorthAmericaNortheast2A => "northamerica-northeast2-a",
                    GcpZone::NorthAmericaNortheast2B => "northamerica-northeast2-b",
                    GcpZone::NorthAmericaNortheast2C => "northamerica-northeast2-c",
                    GcpZone::SouthAmericaEast1A => "southamerica-east1-a",
                    GcpZone::SouthAmericaEast1B => "southamerica-east1-b",
                    GcpZone::SouthAmericaEast1C => "southamerica-east1-c",
                    GcpZone::SouthAmericaWest1A => "southamerica-west1-a",
                    GcpZone::SouthAmericaWest1B => "southamerica-west1-b",
                    GcpZone::SouthAmericaWest1C => "southamerica-west1-c",
                    GcpZone::UsCentral1A => "us-central1-a",
                    GcpZone::UsCentral1B => "us-central1-b",
                    GcpZone::UsCentral1C => "us-central1-c",
                    GcpZone::UsCentral1F => "us-central1-f",
                    GcpZone::UsEast1B => "us-east1-b",
                    GcpZone::UsEast1C => "us-east1-c",
                    GcpZone::UsEast1D => "us-east1-d",
                    GcpZone::UsEast4A => "us-east4-a",
                    GcpZone::UsEast4B => "us-east4-b",
                    GcpZone::UsEast4C => "us-east4-c",
                    GcpZone::UsEast5A => "us-east5-a",
                    GcpZone::UsEast5B => "us-east5-b",
                    GcpZone::UsEast5C => "us-east5-c",
                    GcpZone::UsSouth1A => "us-south1-a",
                    GcpZone::UsSouth1B => "us-south1-b",
                    GcpZone::UsSouth1C => "us-south1-c",
                    GcpZone::UsWest1A => "us-west1-a",
                    GcpZone::UsWest1B => "us-west1-b",
                    GcpZone::UsWest1C => "us-west1-c",
                    GcpZone::UsWest2A => "us-west2-a",
                    GcpZone::UsWest2B => "us-west2-b",
                    GcpZone::UsWest2C => "us-west2-c",
                    GcpZone::UsWest3A => "us-west3-a",
                    GcpZone::UsWest3B => "us-west3-b",
                    GcpZone::UsWest3C => "us-west3-c",
                    GcpZone::UsWest4A => "us-west4-a",
                    GcpZone::UsWest4B => "us-west4-b",
                    GcpZone::UsWest4C => "us-west4-c",
                },
                zone.to_string()
            );
        }
    }

    #[test]
    fn test_gcp_zone_from_str() {
        // test all supported zones
        for zone in GcpZone::iter() {
            assert_eq!(zone, GcpZone::from_str(zone.to_cloud_provider_format()).unwrap());
        }

        // test unsupported zone
        assert!(GcpRegion::from_str("an-unsupported-zone").is_err());
    }
}
